<?php

namespace app\index\controller;

use app\admin\model\Pinjoin;
use app\common\controller\Frontend;

class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function account()
    {
        $name = $this->request->param("name");
        $openid = $this->request->param('openid');
        $this->assign("openid",$openid);
        return $this->view->fetch();
    }

    public function index()
    {
        return $this->view->fetch();
    }

    public function user(){
        return $this->view->fetch();
    }

    public function apply(){
        return $this->view->fetch();
    }

    public function lottery(){

        $id = $this->request->param('id');
        $pinJoinModel = new Pinjoin();
        $pin = $pinJoinModel->where('pid',$id)->where('status','win')->find();
        $userModel = new \app\common\model\User();
        $user = $userModel->where('id',$pin['uid'])->find();
        $this->assign("id",$id);
        $this->assign("name",$user['username']);
        return $this->view->fetch();
    }

}
